Skip to content

feat: add --npm-workspaces option - #550

Open
christoph-sg wants to merge 1 commit into
mainfrom
npm-workspaces
Open

christoph-sg wants to merge 1 commit into
mainfrom
npm-workspaces

Conversation

@christoph-sg

Copy link
Copy Markdown
Contributor

scip-typescript had --yarn-workspaces and --pnpm-workspaces but nothing for npm, so npm monorepos indexed nothing unless every package was listed by hand. This adds --npm-workspaces, which reads the workspaces field from the root package.json (either the array or the { packages: [...] } form) and indexes every directory that has a package.json matching one of those patterns. It expands the patterns with Node's built-in fs.globSync and skips node_modules, which is how npm itself resolves workspaces, so ** and braces work and no install or extra dependency is needed.

This is a smaller version of #459. The fixture and README section come from that PR, with credit to @jojosenthusiast.

Fixes #394

Index every package listed in the root package.json `workspaces` field,
expanded with Node's built-in fs.globSync the same way npm does.

Fixes #394

Co-authored-by: jojosenthusiast <179510577+jojosenthusiast@users.noreply.github.com>
Co-authored-by: Amp <amp@ampcode.com>
Amp-Thread-ID: https://ampcode.com/threads/T-b98ba159-b3e7-454b-ba90-7d8ef49d71b3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for indexing npm workspaces

1 participant